<?php

class EventSubmitAction extends CommonAction{
public function index()
{
$map = $this->_search ();
if($this->get('default_map'))
$map = array_merge($map,$this->get('default_map'));
$event = M('Event')->getById($map['event_id']);
if(!$event)
{
$this->error('没有活动数据');
}
if (method_exists ( $this,'_filter')) {
$this->_filter ( $map );
}
$name=$this->getActionName();
$model = D ($name);
if (!empty ( $model )) {
$this->_list ( $model,$map );
}
$this->display ();
return;
}
public function foreverdelete() {
$ajax = intval($_REQUEST['ajax']);
$id = $_REQUEST ['id'];
if (isset ( $id )) {
$condition = array ('id'=>array ('in',explode ( ',',$id ) ) );
$rel_data = M(MODULE_NAME)->where($condition)->findAll();
foreach($rel_data as $data)
{
$info[] = $data['name'];
$event_id = $data['event_id'];
}
if($info) $info = implode(',',$info);
$list = M(MODULE_NAME)->where ( $condition )->delete();
if ($list!==false) {
M('EventSubmitField')->where(array ('submit_id'=>array ('in',explode ( ',',$id ) ) ))->delete();
M('Event')->where('id='.$event_id)->setField('submit_count',M('EventSubmit')->where('event_id='.$event_id)->count());
save_log($info.l('DELETE_SUCCESS'),1);
$this->success (l('DELETE_SUCCESS'),$ajax);
}else {
save_log($info.l('DELETE_FAILED'),0);
$this->error (l('DELETE_FAILED'),$ajax);
}
}else {
$this->error (l('INVALID_OPERATION'),$ajax);
}
}
}

?>